#include <iostream>
using namespace std;

bool perfect_num(int n)
{
	int sum = 0;
	for (int i = 1; i < n; i++)
	{
		if (n % i == 0)
			sum += i;
	}
	return sum == n;
}

int main()
{
	int n; cin >> n;
	for (int i = 2; i <= n; i++)
	{
		if (perfect_num(i))
			cout << i << endl;
	}
	
	return 0;
}
